﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FbKPI.Facade;
using FbKPI.Model;

namespace FBKPI.Forms
{
    public partial class RGMForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int ID = Convert.ToInt16(Request.QueryString["ID"]);
                if (ID != 0)
                {
                    RGMFacade df = new RGMFacade();
                    RGM RGMs = df.GetRGMByID(ID);

                    if (RGMs != null)
                    {
                        txt_id.Text = RGMs.ID.ToString();
                        hfId.Value = RGMs.ID.ToString();
                        txt_description.Text = RGMs.Description;
                        chk_active.Checked = RGMs.isActive;
                        //txt_businessgroup.Text = RGMs.BusinessGroup.Description;
                        //txt_businessgroupid.Value = RGMs.BusinessGroup.ID.ToString();
                        txt_rgmtype.Text = RGMs.RGMType.Description;
                        txt_rgmtypeid.Value = RGMs.RGMType.ID.ToString();
                        //txt_lastmodifieddate.Text = RGMs.LastModifiedDate == null ? "" : Convert.ToDateTime(RGMs.LastModifiedDate).ToShortDateString();
                        //txt_lastmodifiedby.Text = RGMs.LastModifiedBy;
                        //txt_createdate.Text = RGMs.CreateDate == null ? "" : Convert.ToDateTime(RGMs.CreateDate).ToShortDateString();
                        //txt_createby.Text = RGMs.CreateBy;
                    }
                }
                else
                {
                    txt_id.Text = "0";
                }

                //if (txt_id.Text == "0") btn_delete.Visible = false;
            }
        }
    }
}